require( 'chromedriver' );
const { have } = require( 'selenidejs' );
const { Browser } = require( 'selenidejs' );
const { Builder, Capabilities } = require( 'selenium-webdriver' );
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;


describe( 'The Internet', () => {
    it( 'should have a title',  () => {
        const driver = new Builder().withCapabilities( Capabilities.chrome() ).build();
        // jasmine default timeout is 5 seconds, after that it will automatically fail all tests
        // so we need to extend it

        // now you can create your Browser instance and main entry point to SelenideJS API
        let browser = Browser.configuredWith()
            .driver( driver )
            .timeout( 1000 ) // this is MAXIMUM wait time for elements to be visible or match conditions
            .build();


       return  browser.open( 'http://google.com/' )
           .then( () => {
            return browser.should( have.title( 'Yandex' ) )} )
           .finally( () => browser.quit(),)

    } );
} );